/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * JIFClienteCuentas.java
 *
 * Created on 01-nov-2011, 11:14:53
 */
package jam.sfcc.application;

import jam.sfcc.business.ClienteBusiness;
import jam.sfcc.business.EstadoCivilBusiness;
import jam.sfcc.common.domain.Cliente;
import jam.sfcc.common.domain.EstadoCivil;
import jam.sfcc.common.domain.Vendedor;
import java.sql.SQLException;
import java.util.LinkedList;
import javax.swing.JOptionPane;

/**
 *
 * @author Marlon
 */
public class JIFClienteCuentas extends javax.swing.JInternalFrame {

    Cliente clienteOriginal;
    private Vendedor vendedor;
    private LinkedList<EstadoCivil> estados;

    /** Creates new form JIFClienteCuentas */
    public JIFClienteCuentas(Vendedor vendedor) throws SQLException {
        initComponents();
        this.vendedor = vendedor;
        EstadoCivilBusiness estadoCivilBus = new EstadoCivilBusiness(vendedor.getNombre(), vendedor.getClave());
        estados = estadoCivilBus.getEstadosCiviles();
        for (EstadoCivil estado : estados) {
            cbEstadoCivil.addItem(estado);
            cbEstadoCivilAct.addItem(estado);
        }
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        JTPClientesCuentas = new javax.swing.JTabbedPane();
        JPAbonarCuenta = new javax.swing.JPanel();
        panelEncabezados1 = new jam.sfcc.application.PanelEncabezados();
        jLabel1 = new javax.swing.JLabel();
        JPCrearCuenta = new javax.swing.JPanel();
        JPActualizarCliente = new javax.swing.JPanel();
        jLabel20 = new javax.swing.JLabel();
        tfNombreA = new javax.swing.JTextField();
        tfApellidosA = new javax.swing.JTextField();
        jLabel21 = new javax.swing.JLabel();
        jLabel22 = new javax.swing.JLabel();
        tfCedulaA = new javax.swing.JFormattedTextField();
        jLabel23 = new javax.swing.JLabel();
        ftfTelefonoA = new javax.swing.JFormattedTextField();
        jLabel24 = new javax.swing.JLabel();
        jLabel25 = new javax.swing.JLabel();
        ftfCelularA = new javax.swing.JFormattedTextField();
        cbEstadoCivilAct = new javax.swing.JComboBox();
        jLabel26 = new javax.swing.JLabel();
        jLabel27 = new javax.swing.JLabel();
        jScrollPane3 = new javax.swing.JScrollPane();
        taDireccionA = new javax.swing.JTextArea();
        btnActualizar = new javax.swing.JButton();
        panelEncabezados4 = new jam.sfcc.application.PanelEncabezados();
        jLabel28 = new javax.swing.JLabel();
        btnBuscarAct = new javax.swing.JButton();
        JPBuscarCliente = new javax.swing.JPanel();
        panelEncabezados3 = new jam.sfcc.application.PanelEncabezados();
        jLabel11 = new javax.swing.JLabel();
        jLabel12 = new javax.swing.JLabel();
        tfNombreB = new javax.swing.JTextField();
        tfApellidosB = new javax.swing.JTextField();
        jLabel13 = new javax.swing.JLabel();
        jLabel14 = new javax.swing.JLabel();
        ftfTelefonoB = new javax.swing.JFormattedTextField();
        jLabel16 = new javax.swing.JLabel();
        jLabel17 = new javax.swing.JLabel();
        ftfCelularB = new javax.swing.JFormattedTextField();
        jLabel18 = new javax.swing.JLabel();
        jLabel19 = new javax.swing.JLabel();
        jScrollPane2 = new javax.swing.JScrollPane();
        taDireccionB = new javax.swing.JTextArea();
        btnBuscar = new javax.swing.JButton();
        tfCedulaB = new javax.swing.JFormattedTextField();
        jLabel15 = new javax.swing.JLabel();
        tfEstadoCivilB = new javax.swing.JTextField();
        JPRegistrarCliente = new javax.swing.JPanel();
        panelEncabezados2 = new jam.sfcc.application.PanelEncabezados();
        jLabel2 = new javax.swing.JLabel();
        jLabel3 = new javax.swing.JLabel();
        jLabel4 = new javax.swing.JLabel();
        jLabel5 = new javax.swing.JLabel();
        jLabel6 = new javax.swing.JLabel();
        jLabel7 = new javax.swing.JLabel();
        jLabel8 = new javax.swing.JLabel();
        jLabel9 = new javax.swing.JLabel();
        tfNombre = new javax.swing.JTextField();
        tfApellidos = new javax.swing.JTextField();
        tfCedula = new javax.swing.JFormattedTextField();
        ftfTelefono = new javax.swing.JFormattedTextField();
        ftfCelular = new javax.swing.JFormattedTextField();
        cbEstadoCivil = new javax.swing.JComboBox();
        jScrollPane1 = new javax.swing.JScrollPane();
        taDireccion = new javax.swing.JTextArea();
        btnRegistrar = new javax.swing.JButton();
        jLabel10 = new javax.swing.JLabel();

        setClosable(true);
        setIconifiable(true);
        setTitle("Clientes y Cuentas");
        setName(""); // NOI18N

        JTPClientesCuentas.setBackground(new java.awt.Color(204, 204, 204));
        JTPClientesCuentas.setForeground(new java.awt.Color(255, 255, 255));
        JTPClientesCuentas.setTabLayoutPolicy(javax.swing.JTabbedPane.SCROLL_TAB_LAYOUT);
        JTPClientesCuentas.setTabPlacement(javax.swing.JTabbedPane.LEFT);
        JTPClientesCuentas.setDoubleBuffered(true);
        JTPClientesCuentas.setFont(new java.awt.Font("Century Gothic", 0, 16));

        jLabel1.setFont(new java.awt.Font("Tahoma", 1, 18));
        jLabel1.setText("Abonar Cuenta");

        javax.swing.GroupLayout panelEncabezados1Layout = new javax.swing.GroupLayout(panelEncabezados1);
        panelEncabezados1.setLayout(panelEncabezados1Layout);
        panelEncabezados1Layout.setHorizontalGroup(
            panelEncabezados1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(panelEncabezados1Layout.createSequentialGroup()
                .addGap(160, 160, 160)
                .addComponent(jLabel1)
                .addContainerGap(136, Short.MAX_VALUE))
        );
        panelEncabezados1Layout.setVerticalGroup(
            panelEncabezados1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(panelEncabezados1Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jLabel1)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        javax.swing.GroupLayout JPAbonarCuentaLayout = new javax.swing.GroupLayout(JPAbonarCuenta);
        JPAbonarCuenta.setLayout(JPAbonarCuentaLayout);
        JPAbonarCuentaLayout.setHorizontalGroup(
            JPAbonarCuentaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(panelEncabezados1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
        );
        JPAbonarCuentaLayout.setVerticalGroup(
            JPAbonarCuentaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(JPAbonarCuentaLayout.createSequentialGroup()
                .addComponent(panelEncabezados1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(394, Short.MAX_VALUE))
        );

        JTPClientesCuentas.addTab("Abonar Cuenta", JPAbonarCuenta);

        javax.swing.GroupLayout JPCrearCuentaLayout = new javax.swing.GroupLayout(JPCrearCuenta);
        JPCrearCuenta.setLayout(JPCrearCuentaLayout);
        JPCrearCuentaLayout.setHorizontalGroup(
            JPCrearCuentaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 431, Short.MAX_VALUE)
        );
        JPCrearCuentaLayout.setVerticalGroup(
            JPCrearCuentaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 438, Short.MAX_VALUE)
        );

        JTPClientesCuentas.addTab("Crear Cuenta", JPCrearCuenta);

        jLabel20.setText("Nombre:");

        jLabel21.setText("Apellidos:");

        jLabel22.setText("N° Cédula:");

        try {
            tfCedulaA.setFormatterFactory(new javax.swing.text.DefaultFormatterFactory(new javax.swing.text.MaskFormatter("#-####-####")));
        } catch (java.text.ParseException ex) {
            ex.printStackTrace();
        }
        tfCedulaA.setHorizontalAlignment(javax.swing.JTextField.CENTER);

        jLabel23.setFont(new java.awt.Font("Tahoma", 0, 9));
        jLabel23.setText("1-0452-0619");

        try {
            ftfTelefonoA.setFormatterFactory(new javax.swing.text.DefaultFormatterFactory(new javax.swing.text.MaskFormatter("####-####")));
        } catch (java.text.ParseException ex) {
            ex.printStackTrace();
        }
        ftfTelefonoA.setHorizontalAlignment(javax.swing.JTextField.CENTER);

        jLabel24.setText("Teléfono:");

        jLabel25.setText("Celular:");

        try {
            ftfCelularA.setFormatterFactory(new javax.swing.text.DefaultFormatterFactory(new javax.swing.text.MaskFormatter("####-####")));
        } catch (java.text.ParseException ex) {
            ex.printStackTrace();
        }
        ftfCelularA.setHorizontalAlignment(javax.swing.JTextField.CENTER);

        jLabel26.setText("Estado civil:");

        jLabel27.setText("Dirección:");

        taDireccionA.setColumns(20);
        taDireccionA.setRows(5);
        jScrollPane3.setViewportView(taDireccionA);

        btnActualizar.setText("Actualizar");
        btnActualizar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnActualizarActionPerformed(evt);
            }
        });

        jLabel28.setFont(new java.awt.Font("Tahoma", 1, 18));
        jLabel28.setText("Actualizar Cliente");

        javax.swing.GroupLayout panelEncabezados4Layout = new javax.swing.GroupLayout(panelEncabezados4);
        panelEncabezados4.setLayout(panelEncabezados4Layout);
        panelEncabezados4Layout.setHorizontalGroup(
            panelEncabezados4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(panelEncabezados4Layout.createSequentialGroup()
                .addGap(134, 134, 134)
                .addComponent(jLabel28)
                .addContainerGap(139, Short.MAX_VALUE))
        );
        panelEncabezados4Layout.setVerticalGroup(
            panelEncabezados4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(panelEncabezados4Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jLabel28)
                .addContainerGap(15, Short.MAX_VALUE))
        );

        btnBuscarAct.setText("Buscar");
        btnBuscarAct.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnBuscarActActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout JPActualizarClienteLayout = new javax.swing.GroupLayout(JPActualizarCliente);
        JPActualizarCliente.setLayout(JPActualizarClienteLayout);
        JPActualizarClienteLayout.setHorizontalGroup(
            JPActualizarClienteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(panelEncabezados4, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
            .addGroup(JPActualizarClienteLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(JPActualizarClienteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(JPActualizarClienteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                        .addGroup(javax.swing.GroupLayout.Alignment.LEADING, JPActualizarClienteLayout.createSequentialGroup()
                            .addComponent(jLabel24)
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                            .addComponent(ftfTelefonoA))
                        .addGroup(javax.swing.GroupLayout.Alignment.LEADING, JPActualizarClienteLayout.createSequentialGroup()
                            .addComponent(jLabel25)
                            .addGap(18, 18, 18)
                            .addComponent(ftfCelularA))
                        .addGroup(javax.swing.GroupLayout.Alignment.LEADING, JPActualizarClienteLayout.createSequentialGroup()
                            .addComponent(jLabel26)
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                            .addComponent(cbEstadoCivilAct, javax.swing.GroupLayout.PREFERRED_SIZE, 116, javax.swing.GroupLayout.PREFERRED_SIZE)))
                    .addGroup(JPActualizarClienteLayout.createSequentialGroup()
                        .addComponent(jLabel27)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jScrollPane3, javax.swing.GroupLayout.PREFERRED_SIZE, 334, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, JPActualizarClienteLayout.createSequentialGroup()
                        .addGap(78, 78, 78)
                        .addComponent(btnBuscarAct)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(btnActualizar)
                        .addGap(158, 158, 158)))
                .addContainerGap(35, Short.MAX_VALUE))
            .addGroup(JPActualizarClienteLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(JPActualizarClienteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                    .addGroup(javax.swing.GroupLayout.Alignment.LEADING, JPActualizarClienteLayout.createSequentialGroup()
                        .addComponent(jLabel20)
                        .addGap(18, 18, 18)
                        .addComponent(tfNombreA, javax.swing.GroupLayout.PREFERRED_SIZE, 144, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(javax.swing.GroupLayout.Alignment.LEADING, JPActualizarClienteLayout.createSequentialGroup()
                        .addComponent(jLabel21)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(tfApellidosA)))
                .addContainerGap(218, Short.MAX_VALUE))
            .addGroup(JPActualizarClienteLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jLabel22)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(tfCedulaA, javax.swing.GroupLayout.PREFERRED_SIZE, 101, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jLabel23)
                .addContainerGap(209, Short.MAX_VALUE))
        );
        JPActualizarClienteLayout.setVerticalGroup(
            JPActualizarClienteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, JPActualizarClienteLayout.createSequentialGroup()
                .addComponent(panelEncabezados4, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addGap(9, 9, 9)
                .addGroup(JPActualizarClienteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel22, javax.swing.GroupLayout.PREFERRED_SIZE, 21, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(tfCedulaA, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel23))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(JPActualizarClienteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel20)
                    .addComponent(tfNombreA, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(JPActualizarClienteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel21)
                    .addComponent(tfApellidosA, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addGroup(JPActualizarClienteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel24)
                    .addComponent(ftfTelefonoA, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(JPActualizarClienteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel25)
                    .addComponent(ftfCelularA, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(JPActualizarClienteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel26)
                    .addComponent(cbEstadoCivilAct, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(JPActualizarClienteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel27)
                    .addComponent(jScrollPane3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addGroup(JPActualizarClienteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(btnActualizar)
                    .addComponent(btnBuscarAct))
                .addGap(55, 55, 55))
        );

        JTPClientesCuentas.addTab("Actualizar Cliente", JPActualizarCliente);

        jLabel11.setFont(new java.awt.Font("Tahoma", 1, 18));
        jLabel11.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jLabel11.setText("Buscar Cliente");

        javax.swing.GroupLayout panelEncabezados3Layout = new javax.swing.GroupLayout(panelEncabezados3);
        panelEncabezados3.setLayout(panelEncabezados3Layout);
        panelEncabezados3Layout.setHorizontalGroup(
            panelEncabezados3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, panelEncabezados3Layout.createSequentialGroup()
                .addContainerGap(137, Short.MAX_VALUE)
                .addComponent(jLabel11, javax.swing.GroupLayout.PREFERRED_SIZE, 151, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(143, 143, 143))
        );
        panelEncabezados3Layout.setVerticalGroup(
            panelEncabezados3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(panelEncabezados3Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jLabel11, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addGap(20, 20, 20))
        );

        jLabel12.setText("Nombre:");

        tfNombreB.setEditable(false);

        tfApellidosB.setEditable(false);

        jLabel13.setText("Apellidos:");

        jLabel14.setText("N° Cédula:");

        ftfTelefonoB.setEditable(false);
        try {
            ftfTelefonoB.setFormatterFactory(new javax.swing.text.DefaultFormatterFactory(new javax.swing.text.MaskFormatter("####-####")));
        } catch (java.text.ParseException ex) {
            ex.printStackTrace();
        }
        ftfTelefonoB.setHorizontalAlignment(javax.swing.JTextField.CENTER);

        jLabel16.setText("Teléfono:");

        jLabel17.setText("Celular:");

        ftfCelularB.setEditable(false);
        try {
            ftfCelularB.setFormatterFactory(new javax.swing.text.DefaultFormatterFactory(new javax.swing.text.MaskFormatter("####-####")));
        } catch (java.text.ParseException ex) {
            ex.printStackTrace();
        }
        ftfCelularB.setHorizontalAlignment(javax.swing.JTextField.CENTER);

        jLabel18.setText("Estado civil:");

        jLabel19.setText("Dirección:");

        taDireccionB.setColumns(20);
        taDireccionB.setEditable(false);
        taDireccionB.setRows(5);
        jScrollPane2.setViewportView(taDireccionB);

        btnBuscar.setText("Buscar");
        btnBuscar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnBuscarActionPerformed(evt);
            }
        });

        try {
            tfCedulaB.setFormatterFactory(new javax.swing.text.DefaultFormatterFactory(new javax.swing.text.MaskFormatter("#-####-####")));
        } catch (java.text.ParseException ex) {
            ex.printStackTrace();
        }
        tfCedulaB.setHorizontalAlignment(javax.swing.JTextField.CENTER);

        jLabel15.setFont(new java.awt.Font("Tahoma", 0, 9));
        jLabel15.setText("1-0452-0619");

        tfEstadoCivilB.setEditable(false);

        javax.swing.GroupLayout JPBuscarClienteLayout = new javax.swing.GroupLayout(JPBuscarCliente);
        JPBuscarCliente.setLayout(JPBuscarClienteLayout);
        JPBuscarClienteLayout.setHorizontalGroup(
            JPBuscarClienteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(JPBuscarClienteLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(JPBuscarClienteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(JPBuscarClienteLayout.createSequentialGroup()
                        .addComponent(jLabel14)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(tfCedulaB, javax.swing.GroupLayout.PREFERRED_SIZE, 113, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jLabel15))
                    .addGroup(JPBuscarClienteLayout.createSequentialGroup()
                        .addComponent(jLabel19)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 334, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, JPBuscarClienteLayout.createSequentialGroup()
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 198, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(btnBuscar)
                        .addGap(158, 158, 158))
                    .addComponent(jLabel17)
                    .addComponent(jLabel18)
                    .addGroup(JPBuscarClienteLayout.createSequentialGroup()
                        .addGroup(JPBuscarClienteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                            .addGroup(JPBuscarClienteLayout.createSequentialGroup()
                                .addComponent(jLabel12)
                                .addGap(18, 18, 18)
                                .addComponent(tfNombreB))
                            .addGroup(javax.swing.GroupLayout.Alignment.LEADING, JPBuscarClienteLayout.createSequentialGroup()
                                .addGroup(JPBuscarClienteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(jLabel16)
                                    .addComponent(jLabel13))
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                .addGroup(JPBuscarClienteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(tfApellidosB, javax.swing.GroupLayout.PREFERRED_SIZE, 173, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addGroup(JPBuscarClienteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                                        .addComponent(ftfCelularB, javax.swing.GroupLayout.Alignment.LEADING)
                                        .addComponent(ftfTelefonoB, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.PREFERRED_SIZE, 115, javax.swing.GroupLayout.PREFERRED_SIZE)
                                        .addComponent(tfEstadoCivilB, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.PREFERRED_SIZE, 117, javax.swing.GroupLayout.PREFERRED_SIZE)))))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 156, Short.MAX_VALUE)))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
            .addComponent(panelEncabezados3, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
        );
        JPBuscarClienteLayout.setVerticalGroup(
            JPBuscarClienteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(JPBuscarClienteLayout.createSequentialGroup()
                .addGroup(JPBuscarClienteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(tfEstadoCivilB, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGroup(JPBuscarClienteLayout.createSequentialGroup()
                        .addComponent(panelEncabezados3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(18, 18, 18)
                        .addGroup(JPBuscarClienteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel14, javax.swing.GroupLayout.PREFERRED_SIZE, 21, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(tfCedulaB, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel15))
                        .addGap(10, 10, 10)
                        .addGroup(JPBuscarClienteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel12)
                            .addComponent(tfNombreB, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(9, 9, 9)
                        .addGroup(JPBuscarClienteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(tfApellidosB, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel13))
                        .addGap(18, 18, 18)
                        .addGroup(JPBuscarClienteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel16)
                            .addComponent(ftfTelefonoB, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addGroup(JPBuscarClienteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel17)
                            .addComponent(ftfCelularB, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(jLabel18)))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(JPBuscarClienteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel19)
                    .addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addComponent(btnBuscar)
                .addContainerGap(50, Short.MAX_VALUE))
        );

        JTPClientesCuentas.addTab("Buscar Cliente", JPBuscarCliente);

        JPRegistrarCliente.setBackground(java.awt.SystemColor.window);
        JPRegistrarCliente.setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR));

        jLabel2.setFont(new java.awt.Font("Tahoma", 1, 18));
        jLabel2.setText("Registrar Cliente");

        javax.swing.GroupLayout panelEncabezados2Layout = new javax.swing.GroupLayout(panelEncabezados2);
        panelEncabezados2.setLayout(panelEncabezados2Layout);
        panelEncabezados2Layout.setHorizontalGroup(
            panelEncabezados2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, panelEncabezados2Layout.createSequentialGroup()
                .addContainerGap(141, Short.MAX_VALUE)
                .addComponent(jLabel2)
                .addGap(139, 139, 139))
        );
        panelEncabezados2Layout.setVerticalGroup(
            panelEncabezados2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(panelEncabezados2Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jLabel2)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        jLabel3.setText("Nombre:");

        jLabel4.setText("Apellidos:");

        jLabel5.setText("N° Cédula:");

        jLabel6.setText("Dirección:");

        jLabel7.setText("Teléfono:");

        jLabel8.setText("Celular:");

        jLabel9.setText("Estado civil:");

        try {
            tfCedula.setFormatterFactory(new javax.swing.text.DefaultFormatterFactory(new javax.swing.text.MaskFormatter("#-####-####")));
        } catch (java.text.ParseException ex) {
            ex.printStackTrace();
        }
        tfCedula.setHorizontalAlignment(javax.swing.JTextField.CENTER);

        try {
            ftfTelefono.setFormatterFactory(new javax.swing.text.DefaultFormatterFactory(new javax.swing.text.MaskFormatter("####-####")));
        } catch (java.text.ParseException ex) {
            ex.printStackTrace();
        }
        ftfTelefono.setHorizontalAlignment(javax.swing.JTextField.CENTER);

        try {
            ftfCelular.setFormatterFactory(new javax.swing.text.DefaultFormatterFactory(new javax.swing.text.MaskFormatter("####-####")));
        } catch (java.text.ParseException ex) {
            ex.printStackTrace();
        }
        ftfCelular.setHorizontalAlignment(javax.swing.JTextField.CENTER);

        taDireccion.setColumns(20);
        taDireccion.setRows(5);
        jScrollPane1.setViewportView(taDireccion);

        btnRegistrar.setText("Registrar");
        btnRegistrar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnRegistrarActionPerformed(evt);
            }
        });

        jLabel10.setFont(new java.awt.Font("Tahoma", 0, 9));
        jLabel10.setText("1-0452-0619");

        javax.swing.GroupLayout JPRegistrarClienteLayout = new javax.swing.GroupLayout(JPRegistrarCliente);
        JPRegistrarCliente.setLayout(JPRegistrarClienteLayout);
        JPRegistrarClienteLayout.setHorizontalGroup(
            JPRegistrarClienteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(JPRegistrarClienteLayout.createSequentialGroup()
                .addGroup(JPRegistrarClienteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(panelEncabezados2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGroup(JPRegistrarClienteLayout.createSequentialGroup()
                        .addContainerGap()
                        .addGroup(JPRegistrarClienteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(JPRegistrarClienteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                                .addGroup(javax.swing.GroupLayout.Alignment.LEADING, JPRegistrarClienteLayout.createSequentialGroup()
                                    .addComponent(jLabel3)
                                    .addGap(18, 18, 18)
                                    .addComponent(tfNombre, javax.swing.GroupLayout.PREFERRED_SIZE, 235, javax.swing.GroupLayout.PREFERRED_SIZE))
                                .addGroup(javax.swing.GroupLayout.Alignment.LEADING, JPRegistrarClienteLayout.createSequentialGroup()
                                    .addComponent(jLabel4)
                                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                    .addComponent(tfApellidos)))
                            .addGroup(JPRegistrarClienteLayout.createSequentialGroup()
                                .addComponent(jLabel5)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(tfCedula, javax.swing.GroupLayout.PREFERRED_SIZE, 96, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(jLabel10))
                            .addGroup(JPRegistrarClienteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                                .addGroup(javax.swing.GroupLayout.Alignment.LEADING, JPRegistrarClienteLayout.createSequentialGroup()
                                    .addComponent(jLabel7)
                                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                    .addComponent(ftfTelefono))
                                .addGroup(javax.swing.GroupLayout.Alignment.LEADING, JPRegistrarClienteLayout.createSequentialGroup()
                                    .addComponent(jLabel8)
                                    .addGap(18, 18, 18)
                                    .addComponent(ftfCelular))
                                .addGroup(javax.swing.GroupLayout.Alignment.LEADING, JPRegistrarClienteLayout.createSequentialGroup()
                                    .addComponent(jLabel9)
                                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                    .addComponent(cbEstadoCivil, javax.swing.GroupLayout.PREFERRED_SIZE, 116, javax.swing.GroupLayout.PREFERRED_SIZE)))
                            .addGroup(JPRegistrarClienteLayout.createSequentialGroup()
                                .addComponent(jLabel6)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 334, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, JPRegistrarClienteLayout.createSequentialGroup()
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 150, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addComponent(btnRegistrar)
                                .addGap(158, 158, 158)))))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
        JPRegistrarClienteLayout.setVerticalGroup(
            JPRegistrarClienteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(JPRegistrarClienteLayout.createSequentialGroup()
                .addComponent(panelEncabezados2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(JPRegistrarClienteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel3)
                    .addComponent(tfNombre, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(JPRegistrarClienteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel4)
                    .addComponent(tfApellidos, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(JPRegistrarClienteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel5, javax.swing.GroupLayout.PREFERRED_SIZE, 21, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(tfCedula, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel10))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(JPRegistrarClienteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel7)
                    .addComponent(ftfTelefono, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(JPRegistrarClienteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel8)
                    .addComponent(ftfCelular, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(JPRegistrarClienteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel9)
                    .addComponent(cbEstadoCivil, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(JPRegistrarClienteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel6)
                    .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addComponent(btnRegistrar)
                .addContainerGap(69, Short.MAX_VALUE))
        );

        JTPClientesCuentas.addTab("Registrar Cliente", JPRegistrarCliente);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(JTPClientesCuentas, javax.swing.GroupLayout.PREFERRED_SIZE, 592, javax.swing.GroupLayout.PREFERRED_SIZE)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(JTPClientesCuentas, javax.swing.GroupLayout.DEFAULT_SIZE, 443, Short.MAX_VALUE)
        );

        getAccessibleContext().setAccessibleParent(this);

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void btnRegistrarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnRegistrarActionPerformed
        int resultado = JOptionPane.showConfirmDialog(this, "¿Está seguro de registrar el nuevo cliente?");
        if (resultado == JOptionPane.OK_OPTION) {
            ClienteBusiness clienteBusiness = new ClienteBusiness(vendedor.getNombre(), vendedor.getClave());
            Cliente cliente = new Cliente();
            cliente.setNombre(tfNombre.getText());
            cliente.setApellidos(tfApellidos.getText());
            cliente.setCedula(tfCedula.getText());
            cliente.setDireccion(taDireccion.getText());
            cliente.setEstadoCivil(estados.get(cbEstadoCivil.getSelectedIndex()));
            cliente.setTelefono(ftfTelefono.getText());
            try {
                clienteBusiness.insertarCliente(cliente);
                DialogMensajes dialogMensaje = new DialogMensajes(null, true, "Éxito", "Cliente registrado correctamente");
                dialogMensaje.setVisible(true);
            } catch (SQLException ex) {
                DialogMensajes dialogMensaje = new DialogMensajes(null, true, "Error", ex.getMessage());
                dialogMensaje.setVisible(true);
            }
        }

    }//GEN-LAST:event_btnRegistrarActionPerformed

    private void btnBuscarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnBuscarActionPerformed
        ClienteBusiness clienteBusiness = new ClienteBusiness(vendedor.getNombre(), vendedor.getClave());
        String titulo = "";
        String mensaje = "";
        Cliente cliente = new Cliente();
        try {
            cliente = clienteBusiness.getCliente(tfCedulaB.getText());

            tfNombreB.setText(cliente.getNombre());
            tfApellidosB.setText(cliente.getApellidos());

            taDireccionB.setText(cliente.getDireccion());
            tfEstadoCivilB.setText(cliente.getEstadoCivil().toString());
            ftfTelefonoB.setText(cliente.getTelefono());
            if (cliente.getIdCliente() == 0) {
                titulo = "Error";
                mensaje = "No exste un cliente con ese número de cédula";
            }
        } catch (SQLException ex) {
            titulo = "Error";
            mensaje = ex.getMessage();
        } finally {
            if (cliente.getIdCliente() == 0) {
                DialogMensajes dialogMensaje = new DialogMensajes(null, true, titulo, mensaje);
                dialogMensaje.setVisible(true);
            }
        }


    }//GEN-LAST:event_btnBuscarActionPerformed

    private void btnActualizarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnActualizarActionPerformed

        int resultado = JOptionPane.showConfirmDialog(this, "¿Está seguro de realizar los cambios\n"
                + " en los datos del cliente?");
        if (resultado == JOptionPane.OK_OPTION) {
            ClienteBusiness clienteBusiness = new ClienteBusiness(vendedor.getNombre(), vendedor.getClave());
            Cliente cliente = new Cliente();
            cliente.setIdCliente(clienteOriginal.getIdCliente());
            cliente.setNombre(tfNombreA.getText());
            cliente.setApellidos(tfApellidosA.getText());
            cliente.setCedula(tfCedulaA.getText());
            cliente.setDireccion(taDireccionA.getText());
            cliente.setEstadoCivil(estados.get(cbEstadoCivilAct.getSelectedIndex()));
            cliente.setTelefono(ftfTelefonoA.getText());
            try {
                clienteBusiness.editarCliente(cliente);
                DialogMensajes dialogMensaje = new DialogMensajes(null, true, "Éxito", "Cliente actualizado correctamente");
                dialogMensaje.setVisible(true);
            } catch (SQLException ex) {
                DialogMensajes dialogMensaje = new DialogMensajes(null, true, "Error", ex.getMessage());
                dialogMensaje.setVisible(true);
            }
        }
    }//GEN-LAST:event_btnActualizarActionPerformed

    private void btnBuscarActActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnBuscarActActionPerformed
        ClienteBusiness clienteBusiness = new ClienteBusiness(vendedor.getNombre(), vendedor.getClave());
        String titulo = "";
        String mensaje = "";

        try {
            clienteOriginal = clienteBusiness.getCliente(tfCedulaA.getText());

            tfNombreA.setText(clienteOriginal.getNombre());
            tfApellidosA.setText(clienteOriginal.getApellidos());

            taDireccionA.setText(clienteOriginal.getDireccion());

            ftfTelefonoA.setText(clienteOriginal.getTelefono());
            for (EstadoCivil estado : estados) {
                if (estado.getCodEstado() == clienteOriginal.getEstadoCivil().getCodEstado()) {
                    cbEstadoCivilAct.setSelectedItem(estado);
                }
            }
            if (clienteOriginal.getIdCliente() == 0) {
                titulo = "Error";
                mensaje = "No exste un cliente con ese número de cédula";
            }
        } catch (SQLException ex) {
            titulo = "Error";
            mensaje = ex.getMessage();

        } finally {
            if (clienteOriginal.getIdCliente() == 0) {
                DialogMensajes dialogMensaje = new DialogMensajes(null, true, titulo, mensaje);
                dialogMensaje.setVisible(true);
            }
        }


    }//GEN-LAST:event_btnBuscarActActionPerformed
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JPanel JPAbonarCuenta;
    private javax.swing.JPanel JPActualizarCliente;
    private javax.swing.JPanel JPBuscarCliente;
    private javax.swing.JPanel JPCrearCuenta;
    private javax.swing.JPanel JPRegistrarCliente;
    private javax.swing.JTabbedPane JTPClientesCuentas;
    private javax.swing.JButton btnActualizar;
    private javax.swing.JButton btnBuscar;
    private javax.swing.JButton btnBuscarAct;
    private javax.swing.JButton btnRegistrar;
    private javax.swing.JComboBox cbEstadoCivil;
    private javax.swing.JComboBox cbEstadoCivilAct;
    private javax.swing.JFormattedTextField ftfCelular;
    private javax.swing.JFormattedTextField ftfCelularA;
    private javax.swing.JFormattedTextField ftfCelularB;
    private javax.swing.JFormattedTextField ftfTelefono;
    private javax.swing.JFormattedTextField ftfTelefonoA;
    private javax.swing.JFormattedTextField ftfTelefonoB;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel10;
    private javax.swing.JLabel jLabel11;
    private javax.swing.JLabel jLabel12;
    private javax.swing.JLabel jLabel13;
    private javax.swing.JLabel jLabel14;
    private javax.swing.JLabel jLabel15;
    private javax.swing.JLabel jLabel16;
    private javax.swing.JLabel jLabel17;
    private javax.swing.JLabel jLabel18;
    private javax.swing.JLabel jLabel19;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel20;
    private javax.swing.JLabel jLabel21;
    private javax.swing.JLabel jLabel22;
    private javax.swing.JLabel jLabel23;
    private javax.swing.JLabel jLabel24;
    private javax.swing.JLabel jLabel25;
    private javax.swing.JLabel jLabel26;
    private javax.swing.JLabel jLabel27;
    private javax.swing.JLabel jLabel28;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JLabel jLabel6;
    private javax.swing.JLabel jLabel7;
    private javax.swing.JLabel jLabel8;
    private javax.swing.JLabel jLabel9;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JScrollPane jScrollPane2;
    private javax.swing.JScrollPane jScrollPane3;
    private jam.sfcc.application.PanelEncabezados panelEncabezados1;
    private jam.sfcc.application.PanelEncabezados panelEncabezados2;
    private jam.sfcc.application.PanelEncabezados panelEncabezados3;
    private jam.sfcc.application.PanelEncabezados panelEncabezados4;
    private javax.swing.JTextArea taDireccion;
    private javax.swing.JTextArea taDireccionA;
    private javax.swing.JTextArea taDireccionB;
    private javax.swing.JTextField tfApellidos;
    private javax.swing.JTextField tfApellidosA;
    private javax.swing.JTextField tfApellidosB;
    private javax.swing.JFormattedTextField tfCedula;
    private javax.swing.JFormattedTextField tfCedulaA;
    private javax.swing.JFormattedTextField tfCedulaB;
    private javax.swing.JTextField tfEstadoCivilB;
    private javax.swing.JTextField tfNombre;
    private javax.swing.JTextField tfNombreA;
    private javax.swing.JTextField tfNombreB;
    // End of variables declaration//GEN-END:variables
}
